package com.example.sale24h;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MainMenuArrayAdapter extends ArrayAdapter<String>
{
	private Activity context;
	private String[] names;	
	
	private ImageView imgIcon;
	private TextView tbxItemName;
	
	public MainMenuArrayAdapter(Activity context, int resource, String[] objects)
	{
		super(context, resource, objects);
		this.context=context;
		this.names=objects;
	}

	

	@Override
	public View getView(int position, View convertView, ViewGroup parent)
	{
		View rowView = convertView;
	    if (rowView == null)
	    {
	      LayoutInflater inflater = context.getLayoutInflater();
	      rowView = inflater.inflate(R.layout.mainmenuitem_layout, null);
	      
	      imgIcon = (ImageView) rowView.findViewById(R.id.imgsttaus);
	      tbxItemName = (TextView) rowView.findViewById(R.id.tbxItemName);
	          
	    }	    
	    String s = names[position];
	    tbxItemName.setText(s);
	    imgIcon.setImageResource(R.drawable.ic_launcher);
	    
	    return rowView;
	}
}
